import torch

def examine_model_file(model_path):
    """检查模型文件的结构"""
    print(f"正在检查模型文件: {model_path}")
    
    # 加载模型
    checkpoint = torch.load(model_path, map_location=torch.device('cpu'))
    
    # 打印模型文件内的键
    print("模型文件中的键:")
    for key in checkpoint.keys():
        print(f"- {key}")
    
    # 如果包含model_state_dict，检查它的结构
    if 'model_state_dict' in checkpoint:
        print("\n模型状态字典中的键:")
        for key in checkpoint['model_state_dict'].keys():
            print(f"- {key}")

if __name__ == "__main__":
    # 检查三个模型文件
    model_paths = [
        "models/weights/generator.pth",
        "models/weights/flower.pth",
        "models/weights/face.pth"
    ]
    
    for path in model_paths:
        examine_model_file(path)
        print("\n" + "-"*50 + "\n") 